package com.wb.business.service;

import com.ruoyi.project.relation.domain.ao.SyncActionRequest;
import com.ruoyi.project.relation.domain.ao.SyncActonResponse;
import com.wb.business.config.BusinessEntityManager;
import org.apache.poi.ss.formula.functions.T;
import org.shoukaiseki.common.exception.MessageVirtualException;
import org.springframework.validation.annotation.Validated;

public interface BusinessEntityService {

    //存在循环依赖的情况下,使用该方式初始化 BusinessEntityManager
    default void setBusinessEntityManager(BusinessEntityManager businessEntityManager){

    }

    /**
     * <pre>
     * 返回接口的实现类,不能为空
     * 方便以插件模式进行开发
     * </pre>
     * @return  @NotNull
     */
    Object getBusinessEntityServiceImpl() ;

    /**
     *
     * @param uniqueId
     * @return    @NotBlank   <T>
     */
    @Deprecated
    default <T> T getBusinessEntity(Long uniqueId, Integer showVirtualBitFilter){
        return getBusinessEntity(uniqueId);
    }

    default <T> T getBusinessEntity(Long uniqueId){
        throw new MessageVirtualException("未定义");
    }

//  void setBusinessEntityManager(BusinessEntityManager bem);

    String getTableName();

    /**
     * 主键名称
     * @return
     */
    default String getUniqueIdName(){
        return getTableName()+"_id";
    }


    default String getTitle(String appName){
        return "";
    }

    default String getBusinessType(Long ownerId){
        throw new MessageVirtualException("暂不支持该ownerName.getBusinessType{}").format(ownerId);
    }

    /**
     * @see BusinessEntityManager#getRequestReserveBomBusinessName(String, Long, Long)
     */
    default String getRequestReserveBomBusinessName(String ownerName,Long ownerId,Long bomId){
        return "";
    }


    /**
     * @see BusinessEntityManager#getResponseReserveBomBusinessName(String, Long, Long)
     */
    default String getResponseReserveBomBusinessName(String ownerName,Long ownerId,Long bomId){
        return "";
    }



    /**
     * @see BusinessEntityManager#getRequestReserveBomOwnerType(String, Long, Long)
     */
    default String getRequestReserveBomOwnerType(String ownerName,Long ownerId,Long bomId){
        return "";
    }


    /**
     * @see BusinessEntityManager#getResponseReserveBomOwnerType(String, Long, Long)
     */
    default String getResponseReserveBomOwnerType(String ownerName,Long ownerId,Long bomId){
        return "";
    }

    default SyncActonResponse syncAction(SyncActionRequest syncActionRequest){
        throw new MessageVirtualException("暂不支持该beanName触发方式{}").format(syncActionRequest.getBeanName());
    }


    /**
     * 库存预留中显示的信息
     * @param uniqueId
     * @param <T>
     * @return
     */
    default <T> T getBusinessInventoryReserveLabel(Long uniqueId){
        throw new MessageVirtualException("未定义");
    }
}
